# # -*- coding:utf-8 -*-
# """
# __author__='Wang Bo'
# email:joker_wb@163.com
# 川大研究生信息爬取
# """
#
# import requests
# from bs4 import BeautifulSoup
# from 有意思.mysql_code import MysqlHelpe
# my_shujuku=MysqlHelpe('127.0.0.1','root','123456','scu_yjs','utf8')
# url2="http://yz.scu.edu.cn"
# sql="INSERT INTO yjs_xx(url,title) VALUES ('%s','%s')"
# for i in range(1,12):
#     url = "http://yz.scu.edu.cn/zsxx/zxxw?pg={0}".format(i)
#
#     html=requests.request('GET',url)
#
#     bf_scu=BeautifulSoup(html.text,'lxml')
#     #找到ul标签
#     xwlist=bf_scu.find_all("ul",{"class":'xwlist'})[0]
#
#     # print(xwlist)
#     xwlist_alla=xwlist.find_all('a')
#
#     for alla in xwlist_alla:
#         new_url=url2+alla['href']
#         scu_title=alla.text
#
#         my_shujuku.cud(sql,(new_url,scu_title))
#
import requests
# from mySQL_test import MysqlHelpe
from bs4 import BeautifulSoup
url2='http://yz.scu.edu.cn/'
# yjs_list_paqu=MysqlHelpe('3306','ROOT','123456','scu_yjs','utf8')
# sql="INSERT INTO xwlist(title,url,content) VALUES('%s','%s','%s')"
for i in range(1,12):
    url='http://yz.scu.edu.cn/zsxx/zxxw?pg={0}',format(i)
    html=requests.request('GET',url)
    # html=requests.get(url)
    bf_html=BeautifulSoup(html.text,'lxml')
    list_html=bf_html.find_all('ul',{'class':'xwlist'})[0]
    url_html=list_html.find_all('a')
    for i in url_html:
        url_=url2+i['href']
        title=i.text
        print(url_)
        print(title)